{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h4>课堂纪律反馈列表</h4>
        <a href="{% url 'core:class_evaluation_create' %}" class="btn btn-primary"><i class="bi bi-plus-circle me-2"></i>添加评价</a>
    </div>

    <div class="card">
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>课程安排</th>
                        <th>评价等级</th>
                        <th>评价日期</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for evaluation in evaluations %}
                    <tr>
                        <td>{{ evaluation.class_schedule }}</td>
                        {% if evaluation.evaluation == 'good' %}
                        <td><span style="color: green; font-weight: bold;">{{ evaluation.get_evaluation_display }}</span></td>
                        {% elif evaluation.evaluation == 'poor' %}
                        <td><span style="color: red; font-weight: bold;">{{ evaluation.get_evaluation_display }}</span></td>
                        {% else %}
                        <td>{{ evaluation.get_evaluation_display }}</td>
                        {% endif %}
                        <td>{{ evaluation.date }}</td>
                        <td>
                            <a href="{% url 'core:class_evaluation_update' evaluation.pk %}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-pencil me-1"></i>编辑</a>
                            <a href="{% url 'core:class_evaluation_delete' evaluation.pk %}" class="btn btn-sm btn-outline-danger"><i class="bi bi-trash me-1"></i>删除</a>
                        </td>
                    </tr>
                    {% empty %}
                    <tr>
                        <td colspan="4" class="text-center">暂无评价记录</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}